//------------------------------------------------------------------------------
// Copyright (C) 2007-2008 Samuel Lacroix
// This file is part of Visual Local History 2005
// 
// Visual Local History 2005 is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the License,
// or (at your option) any later version.
// 
// Visual Local History 2005 is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Visual Local History 2005; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//------------------------------------------------------------------------------

#include "StdAfx.h"
#include "FormConfig.h"


#include "Config.h"


void HistoryAddIn::FormConfig::ApplyConfig()
{
    ConnectObject->config->IgnoredExts = textBoxExcludedFiles->Text;
//     ConnectObject->config->MaxEntriesPerFile = Convert::ToInt32(numericUpDownMaxBackupsPerFile->Value);
//     ConnectObject->config->MaxHistorySizePerFile =  Convert::ToInt32(numericUpDownMaxHistorySizePerFile->Value);
    ConnectObject->config->MinTimeBetweenBackups =  Convert::ToInt32(numericUpDownMinTimeBetweenBackups->Value);
    ConnectObject->config->RetentionTimeInDays =  Convert::ToInt32(numericUpDownRetentionTime->Value);
    ConnectObject->config->DiffToolCommand = textBoxDiffToolCommand->Text;
    ConnectObject->config->DiffToolArgs = textBoxDiffToolArgs->Text;
    ConnectObject->config->NewVersionCheck = checkBox1->Checked;

    ConnectObject->config->SaveToAppConfig();
}


void HistoryAddIn::FormConfig::ReadConfig()
{
    ConnectObject->config->LoadFromAppConfig();
    textBoxExcludedFiles->Text = ConnectObject->config->IgnoredExts;
//     numericUpDownMaxBackupsPerFile->Value = ConnectObject->config->MaxEntriesPerFile;
//     numericUpDownMaxHistorySizePerFile->Value = ConnectObject->config->MaxHistorySizePerFile;
    numericUpDownMinTimeBetweenBackups->Value = ConnectObject->config->MinTimeBetweenBackups;
    numericUpDownRetentionTime->Value = ConnectObject->config->RetentionTimeInDays;
    textBoxDiffToolCommand->Text = ConnectObject->config->DiffToolCommand;
    textBoxDiffToolArgs->Text = ConnectObject->config->DiffToolArgs;
    checkBox1->Checked = ConnectObject->config->NewVersionCheck;
}
